package practice1_100;

public class Practice34 {
    public int[] searchRange(int[] nums, int target) {
        return null;
    }
    public int dp(int[] nums, int target,int begin,int end){
        int mid=(begin+end)/2;
        if(nums[mid]==target&&mid-1>=0&&nums[mid-1]<target) return mid;
        if(nums[mid]==target&&mid+1< nums.length&&nums[mid+1]>target) return mid;

        if(nums[mid]==target) {
           return dp(nums,target,begin,mid-1);
           //return dp(nums,target,mid+1,end);
        }else if(nums[mid]>target){
           return dp(nums,target,begin,mid-1);
        }else {
            return dp(nums,target,mid+1,end);
        }

    }
}
